﻿using System;
using System.Data.Services.Common;
using System.Runtime.Serialization;
using Microsoft.WindowsAzure.StorageClient;

namespace TechEd.Data.Core.Entity.Base
{
	[DataContract]
 [DataServiceKey(new string[] { "PartitionKey", "RowKey" })]
	public abstract class BaseEntity //: TableServiceEntity
	{
/*		protected BaseEntity()
		{
			Id = EmptyGuid;
		}*/

/*		internal BaseEntity(string partitionKey, string rowKey) : base(partitionKey, rowKey)
		{
		}*/

		public static Guid EmptyGuid{get{return new Guid();}}

		public virtual System.String PartitionKey { set; get; }
		public virtual System.String RowKey { set; get; }
		private DateTime? _timestamp;
		public System.DateTime Timestamp
		{
			set { _timestamp = value; }
			get { return _timestamp ?? (_timestamp = DateTime.Now).Value; }
		}



/*
		public Guid Id { get; set; }
*/
	}
}

/*
public abstract class TableServiceEntity
{
    // Fields
    [CompilerGenerated]
    private string <PartitionKey>k__BackingField;
    [CompilerGenerated]
    private string <RowKey>k__BackingField;
    [CompilerGenerated]
    private DateTime <Timestamp>k__BackingField;

    // Methods
    protected TableServiceEntity()
    {
    }

    protected TableServiceEntity(string partitionKey, string rowKey)
    {
        this.PartitionKey = partitionKey;
        this.RowKey = rowKey;
    }

    // Properties
    public virtual string PartitionKey
    {
        [CompilerGenerated]
        get
        {
            return this.<PartitionKey>k__BackingField;
        }
        [CompilerGenerated]
        set
        {
            this.<PartitionKey>k__BackingField = value;
        }
    }

    public virtual string RowKey
    {
        [CompilerGenerated]
        get
        {
            return this.<RowKey>k__BackingField;
        }
        [CompilerGenerated]
        set
        {
            this.<RowKey>k__BackingField = value;
        }
    }

    public DateTime Timestamp
    {
        [CompilerGenerated]
        get
        {
            return this.<Timestamp>k__BackingField;
        }
        [CompilerGenerated]
        set
        {
            this.<Timestamp>k__BackingField = value;
        }
    }
}


 */